package com.lolc.ihm.component;

public class ComboBoxItem {

	private String id;

	private String value;

	public ComboBoxItem()
	{
		super();
	}

	public ComboBoxItem(String id, String value)
	{
		this.id = id;
		this.value = value;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}


	public String getValue()
	{
		return value;
	}


	@Override
	public String toString()
	{
		if(this.value!=null)
			return this.value;
		else
			return "";
		// return value!=null?this.value:"";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ComboBoxItem other = (ComboBoxItem) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public int compareTo(ComboBoxItem c)
	{
		return this.id.compareTo(c.getId());
	}
}
